package com.mesd.killer.ui.tools;

import java.awt.Desktop;
import java.net.URI;

public class DeskTopBrowser {

	private static String header = "http://";

	/**
	 * 调用默认浏览器显示指定的URL
	 * 
	 * @param uri
	 */
	public static void showDesktopBrowse(String uri) {
		try {
			if (uri.startsWith("www.")) {
				uri = header + uri;
			}

			showUrlDesktopBrowse(new URI(uri));
		} catch (Exception e) {
		}
	}

	/**
	 * 调用默认浏览器显示指定的URL
	 * 
	 * @param uri
	 */
	public static void showUrlDesktopBrowse(URI uri) {
		try {
			if (Desktop.isDesktopSupported()) {
				Desktop desktop = Desktop.getDesktop();
				desktop.browse(uri);
			}
		} catch (Exception e) {
		}
	}
}
